<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\widgets\LinkPager;
use yii\helpers\Url;

$this->params['breadcrumbs'][] = $this->title;

?>
<div class="goodsDetail">

  <div class="content">
    <div class="content-wrap">
      <div class="contLeft left">
        <h1 class="mainTt">
          <span class="name"><?= Html::encode($product->name);?></span>
          <span class="sharedInfo right">
            <a class="inlineBlock collect ">收藏商品 
            <span class="inlineBlock oneStar <?php if($is_collect){echo 'collected';}?>"></span>
            </a>
            <!-- <a class="inlineBlock share">分享<img src="http://static.tianpinwang.com.cn/v1/images/share-icon.png" alt=""></a> -->
          </span>
        </h1>
        <div class="goodsInfo">
          <div class="goodsImges">
            <div class="mainImage">
              <div class="littleImg">

                <img src="<?= Html::encode($product->img_url)?>" style='max-height: 340px'>
                <?php foreach ($product_img as $key => $value): ?>
                  <img src="<?= Html::encode($value->img_url)?>" style='max-height: 340px'>
                <?php endforeach ?>

              </div>
              <div class="bigImage">

                <img src="<?= Html::encode($product->img_url)?>">
                <?php foreach ($product_img as $key => $value): ?>
                  <img src="<?= Html::encode($value->img_url)?>">
                <?php endforeach ?><!-- 
                <img src="http://static.tianpinwang.com.cn/v1/images/goodsDetail/bigImage.png" alt="" class="current">
                <img src="http://static.tianpinwang.com.cn/v1/images/goodsDetail/bigImage1.png" alt=""> -->
              </div>
              <div class="maskLook"></div>
              <div class="topMask"></div>
            </div>
            <div class="thumbnail">
              <div class="images">
                <div class="img"><img src="<?= Html::encode($product->img_url)?>!s100" alt = "<?= Html::encode($product->title)?>"></div>
                <?php foreach ($product_img as $key => $value): ?>
                  <div class="img"><img src="<?= Html::encode($value->img_url)?>!s100" alt = "<?= Html::encode($value->title)?>"></div>
                <?php endforeach ?>
                <!-- <div class="img active"><img src="http://static.tianpinwang.com.cn/v1/images/littleIme.png" alt=""></div> -->
              </div>

            </div>
          </div>


          <div class="tt1" style="height:70px;">
            <p class="priceInfo">价格
             <span class="price">
              <span class="font16">￥</span><?= Html::encode($product->product_price)?>
              <span style="font-size:14px;">
                /<?= Html::encode($product->price_unit)?>
              </span>
             </span>
            </p>
           <!--  <p class="countLower">起批量 <span class="count">1~4 <?=\common\models\Product::itemAlias('weight_unit', $product->weight_unit)?></span></p> -->
           <p class="countLower">产品规格 <span class="count"><?= Html::encode($product->spec)?></span></p>
          </div>

          <div class="shipInfo" style="display:none">
            配送至
            <div class="peisong">
              <div class="left positionr selectBox">
                <div class="input_btn">
                  <span class="txts"><?= Html::encode($province[0]['name'])?></span>
                  <img src="http://static.tianpinwang.com.cn/v1/images/downIcon.png" alt="" class="selectIcon">
                </div>
                <div class="selectLists">
                  <ul class="navList">
                    <li class="cur" value="<?= Html::encode($province[0]['id'])?>"><?= Html::encode($province[0]['name'])?></li>
                    <li>请选择城市</li>
                    <li style="display: none;">请选择区域</li>
                  </ul>
                  <div class="sec_childs">
                      <!--配送区域-一级目录-->
                      <div class="sec_level sec_level1 clearfix" tag-index="1" style="display: block;">
                        <div class="arealist clearfix">
                          <div class="dd">
                            <?php foreach ($province as $key => $value): ?>
                              <a class=<?php if($key==0){echo "'sec_item selected'";}else{echo "'sec_item'";}?>
                              href="javascript:void(0);" value="<?= Html::encode($value['id'])?>">
                              <?= Html::encode(mb_strlen($value['name'])>6?$value['name']:$value['name'].' ')?>&nbsp;</a>
                            <?php endforeach ?>
                          </div>
                        </div>
                      </div>

                      <div class="sec_level sec_level2 clearfix" tag-index="2" id="mod_address_city"></div>
                      <div class="sec_level sec_level3 clearfix" tag-index="3" id="mod_address_town">
                        <a class="sec_item" href="javascript:void(0);" value="<?= Html::encode($province[0]['name'])?>"><?= Html::encode($province[0]['name'])?></a>
                      </div>
                  </div>


                  <img src="http://static.tianpinwang.com.cn/v1/images/closeIcon1.png" alt=""  class="closeSeletBox">
                </div>
              </div>

              <span class="txt1"><?= Html::encode($product->supply)?></span>
              <span class="txt2">运费说明<a href="" class="icon inlineBlock">?</a></span>
            </div>
          </div>
          <br>
          <p class="star">成交/评价 
            <span class="evaluteBack inlineBlock">
              <span class="evalute inlineBlock"></span>
            </span>
            <span class="dealInfo">
              <span><em><?= Html::encode($product->suc_amount)?></em><?= Html::encode($product->price_unit)?>成交</span>
              <!-- <span><em>63</em>条评论</span> -->
            </span>
          </p>
          <div class="inventory">
            <div class="purchases">采购量 <div class="countInput inlineBlock">
              <input type="number" value="" id="product_num">
              <span class="reduce inlineBlock disabled">-</span>
              <span class="add inlineBlock">+</span>
            </div>
              <span class="available">
                <?=Html::encode($product->price_unit)?>（<span class="availableNum">
                  <?= Html::encode($product->stock)?></span>
                <?=Html::encode($product->price_unit)?>可售）
              </span>

              <p class="minrangeError">最小起批量为<span class="minRange"></span><?= Html::encode($product->price_unit)?></p>
              <p class="maxrangeError">最大采购量为<span class="maxRange"></span><?= Html::encode($product->price_unit)?></p>
            </div>
            <p class="addToCart"><a href="javascript:;" class="addBtn inlineBlock">加入订货单</a></p>
          </div>

        </div>

        <?php if($product->send_sample == 2){?>
        <div class="subInfo">
          <ul>
            <li>
              <p class="tt0">免费拿样</p>
              <p class="tt1">进货先拿样，批发有保障！</p>
            </li>
            <li>
              <p class="tt2">拿样支付后30天内，二次进同款货品满300元返还样品费<br>每个用户限购 1 件。<a href="">拿样规则></a></p>
            </li>
            <li>
              <p class="tt1 tt3">拿样价 <span  class="price">￥30.00/<?= Html::encode($product->price_unit)?></span></p>
              <p class="tt1">运费 <span class="carriage">与产品运费一致</span></p>
            </li>
            <li>
              <a href="" class="inlineBlock sampleNow">立即拿样</a>
              <a href="" class="inlineBlock sampleFree">企业会员免支付拿样</a>
            </li>
          </ul>
        </div>
        <?php }else{?>
        <?="<br/>";}?>      <!--如果不允许寄送样品、加个换行调整样式-->
        <div class="dealInfo">
          <div class="tabNav">
            <ul class="navs">
              <li class="cur">详细信息</li>
              <!-- <li>成交 <span><?= Html::encode($product->suc_amount)?></span></li> -->
              <!-- <li>评价 <span>61</span></li> -->
            </ul>
          </div>

          <div class="tabItems">
            <div class="item">
              <!-- <div class="parameters">
                <ul>
                  <li>标准参数<span>标准参数</span></li>
                  <li>标准参数<span>标准参数</span></li>
                  <li>标准参数<span>标准参数</span></li>
                </ul>
              </div> -->
              <div class="itemDetail">
                <p><?= \yii\helpers\HtmlPurifier::process($product->des)?></p>
              </div>
            </div>
            <div class="item dealRecord"><!-- 
              <h1 class="tt0">成交记录</h1> -->
              <?php if(!$order_list){?>
              <p class="noneInfo">该商品暂无成交记录</p><br/>
              <?php }else{?>
              <div class="dealLists">
                <h1 class="tt">
                  <span style = 'margin-left:23px'>采购商</span>
                  <span style = 'margin-left:-28px'>成交金额（元）</span>
                  <span style = 'margin-left:8px'>数量</span>
                  <span style = 'margin-left:34px'>成交时间</span>
                </h1>
                <div class="records">
                  <?php foreach ($order_list as $key => $value): ?>
                    <p class="oneRecord">
                      <span><?= Html::encode(mb_substr($value['username'],0,6,'utf-8').'*****')?></span>
                      <span class="price"><?= Html::encode($value['order_fee'])?></span>
                      <span><?= Html::encode($value['product_num']." ".$product->price_unit)?></span>
                      <span class="dealTime"><?= Html::encode($value['create_time'])?></span>
                    </p>
                  <?php endforeach ?>  
                </div>

                <?php if($order_list){?>
                <div class="evalutePag">
                  共<span><?= Html::encode($page['last_page'])?></span>页
                  <span class="evaluteToggle inlineBlock">
                    <span name='order_list' class="inlineBlock evalutePre" value="1">＜</span>
                    <span class="page inlineBlock" id='curr'><?= Html::encode($page['curr_page'])?></span>
                    <span name='order_list' class="inlineBlock evaluteNext" value="<?= Html::encode($page['curr_page']+1>$page['last_page']?$page['last_page']:$page['curr_page']+1)?>">＞</span>
                  </span>
                </div>
                <?php }?>

              </div>
              <?php }?>
            </div>
            <div class="item evaluation" >
              <h1 class="tt">评价</h1>
              <p class="noneInfo">该商品暂无评价</p>
              <div class="evaluteLists" style="display: none;">

                <div class="oneEvaluation">
                  <p class="evaluteTxt">真是不错，这么远也能送到，东西质量杠杠的，我还会再来的！</p>
                  <p class="evaluteTime">2016-08-08 12:30:30</p>
                  <div class="dealName">
                    <p class="evaluteUser">138****8888</p>
                    <span class="evaluteBack inlineBlock"><span class="evalute inlineBlock"></span></span>
                  </div>
                </div>

                <div class="evalutePag">
                  共<span>6</span>页
                    <span class="evaluteToggle inlineBlock">
                      <span class="inlineBlock evalutePre">＜</span>
                      <span class="page inlineBlock">5</span>
                      <span class="inlineBlock evaluteNext">＞</span>
                  </span>
                </div>
              </div>

            </div>
          </div>
        </div>

      </div>
      <div class="contRight right">
        <div class="cont1" style="display:none">
          <h1 class="tt">买家还在看 
            <!-- <span class="right">
            <span class="preLooked inlineBlock">＜</span>
            <span class="nextLooked inlineBlock">＞</span>
            </span> -->
          </h1>
          <ul class="lookedList">

            <?php foreach ($product_others as $key => $value): ?>
              <li>
                <a href="<?= Html::encode($value['id'])?>">
                  <h1 class="name"><?= Html::encode($value['name'])?></h1>
                  <p class="price">￥<?= Html::encode($value['product_price'].'/'.$value['price_unit'])?></p>
                  <img src="<?php if($value['img_url']){echo Html::encode($value['img_url']).'!s50x50';}?>" class="img">
                </a>
              </li>
            <?php endforeach ?>

          </ul>
        </div>
        <div class="cont2">
          <h1 class="tt">最近浏览过</h1>
          <ul class="lookedList">

          <?php if (count($scan_list)): ?>
              <?php foreach ($scan_list as $k => $v): ?>
                <?php if ($k<10): ?>
                    <li>
                      <a href="<?= Url::toRoute(['product/'.$v['id']]);?>" value='<?=Html::encode($v['name'])?>'>
            <h1 class="name">
              <?=Html::encode((strlen($v['name'])>24)?mb_substr($v['name'],0,7,'utf-8').'...':$v['name'])?>
            </h1>
                        <p class="price">￥<?=Html::encode($v['product_price'])?>/<?=Html::encode($v['price_unit'])?></p>
                        <img src="<?=Html::encode($v['img_url']?$v['img_url']:'http://static.tianpinwang.com.cn/file/2016/07/20/65tyl65cnvnqxhpg.png')?>!s50x50" alt="" class="img" style = 'margin-top: 13px'>
                      </a>
                    </li>
                <?php endif ?>
              <?php endforeach ?>
          <?php else: ?>
              <li class="nullInfo">暂无记录</li>
          <?php endif ?>
            
          </ul>
        </div>
      </div>
    </div>
  </div>

  <div class="mask"></div>
  <div class="popInfo successAdd">
    <img src="http://static.tianpinwang.com.cn/v1/images/addCartSuccess.png" alt="" class="icon">
    <h1 class="tt">货品添加成功！</h1>
    <p class="txt">当前进货单共<span id="now_cart">1</span>种货品</p>
    <p class="btns"><a href="/mycount/cart-list" class="settlement inlineBlock">去结算</a><a href="javascript:;" class="inlineBlock goOn">继续采购</a></p>
    <span class="close">×</span>
  </div>
  <div class="popInfo failAdd">
    <img src="http://static.tianpinwang.com.cn/v1/images/addCartFail.png" alt="" class="icon">
    <h1 class="tt">添加货品失败</h1>
    <p class="txt">已超出进货单最大容量</p>
    <p class="btns"><a href="" class="closeBtn inlineBlock">关闭</a></p>
    <span class="close">×</span>
  </div>

  <div class="collectTip">
    <img src="http://static.tianpinwang.com.cn/v1/images/addCartSuccess.png" alt="">
    收藏成功
  </div>

  <div class="sampleFailTip">
    <img src="http://static.tianpinwang.com.cn/v1/images/addCartFail01.png" alt="">
    你已经领取过该样品，不能重复申请。
  </div>
</div>



<script>/*
  $(function(){
    $("a:contains('...')").mouseover(function(){
      var th=this;
      layer.tips($(th).attr('value'),th,{tips:[1,'#31A900'],time: 2000});
    });
  })*/
  $(function(){
    $('#lv1_nav a').attr('class','');

    var $messageInfo=$('.messageInfo');
    var $cartList=$('.cartList');
    if($messageInfo.text().length>1){
      $messageInfo.addClass('bigNumber');
    }
    $('.sub-nav').children('dl').on('mouseenter',function(){
      $(this).addClass('hover').children('.moreItem').css('display','block');
    }).on('mouseleave',function(){
      $(this).removeClass('hover').children('.moreItem').css('display','none');
    });
    $cartList.children('li').on('mouseenter',function(){
      $(this).find('.close').css('display','block');
    }).on('mouseleave',function(){
      $(this).find('.close').css('display','none');
    });
    $cartList.find('.close').on('click',function(e){
      e.preventDefault();
      $(this).parent().parent().remove();
    });
    $('.shopping').on('mouseover',function(){
      $('.popList').css('display','block');
    }).on('mouseout',function(){
      $('.popList').css('display','none');
    });
    $('.logged').on('mouseenter',function(){
      $('.popNav').css('display','block');
    }).on('mouseleave',function(){
      $('.popNav').css('display','none');
    });


//    goodsDetail
    var $thumbnail=$('.thumbnail');
    var $images=$('.goodsImges').find('.mainImage').find('.littleImg').children('img');
    $images.eq(0).css('display','block');
    $thumbnail.find('.img').on('mouseenter',function(){
      var $n=$(this).index();
      $(this).addClass('active').siblings().removeClass('active');
      $images.css('display','none').eq($n).fadeIn(100);
    });


    var $minCount=1;
    var $maxCount=<?php echo $product->stock?>;
    var $countInput=$('.countInput');
    var $input=$countInput.children('input');
    var $reduce= $countInput.find('.reduce');
    var $add=$countInput.find('.add');
    var $minrangeError=$('.minrangeError');
    var $maxrangeError=$('.maxrangeError');

    if($maxCount==0){

      $input.val(0);
      $('.inventory').addClass('noCount').find('.addBtn').addClass('disabledBtn').text('暂无库存');
      $reduce.removeClass('disabled').addClass('disabled');
      $add.removeClass('disabled').addClass('disabled');
      $input.attr('disabled','disabled').css('color','#999');

    }else {

      $('.minRange').text($minCount);
      $('.maxRange,.availableNum').text($maxCount);

      $input.val($minCount);
      //加
      $countInput.find('.add').on('click',function(){
        var $val=$input.val();
        $val++;
        if($val>$minCount){
          $countInput.find('.reduce').removeClass('disabled');
        }
        if($val==$maxCount+1){
          return;
        }
        $input.val($val);
        if($val>=$maxCount){
          $(this).removeClass('disabled').addClass('disabled');
        }
      });
      //减
      $countInput.find('.reduce').on('click',function(){
        var $val=$input.val();
        if($val==$minCount){
          return;
        }
        $val--;
        $input.val($val);
        if($val<=$minCount){
          $(this).removeClass('disabled').addClass('disabled');
        }
        if($val<$maxCount){
          $countInput.find('.add').removeClass('disabled');
        }
      });



      $input.on('blur',function(){
        var $val1=$input.val();
        if($val1>$maxCount){
          $minrangeError.css('display','none');
          $maxrangeError.css('display','block');
          setTimeout(function(){$maxrangeError.fadeOut(1000);},2600);
          $input.val($maxCount);
          $add.removeClass('disabled').addClass('disabled');
          $reduce.removeClass('disabled');
        }else if($val1<$minCount){
          $maxrangeError.css('display','none');
          $minrangeError.css('display','block');
          setTimeout(function(){$minrangeError.fadeOut(1000);},2600);
          $input.val($minCount);
          $reduce.removeClass('disabled').addClass('disabled');
          $add.removeClass('disabled');
        }else if($val1>$minCount&&($val1<$maxCount)){
          $add.removeClass('disabled');
          $reduce.removeClass('disabled');
        }
      })

    }


    var $pop=$('.popInfo');
    var $goodsDetail=$('.goodsDetail');
    var $popSuccess= $goodsDetail.find('.successAdd');
    var $popFail= $goodsDetail.find('.failAdd');
    var $mask=$('.mask');

    //加入购物车
    $('.addToCart .addBtn').on('click',function(e){
      e.preventDefault();
      var product_num = $('#product_num').val();
      var uid = <?php echo Yii::$app->user->isGuest?1:0?>;
      if(uid){
        layer.msg('请先登录',{time:1200},function(){
          window.location.href = '/site/login';
        });
        return false;
      }
      $.ajax({
        type: "POST",
        url: "/shopping-cart/add",
        data: "product_id=<?=$product->id?>"+"&product_num="+product_num+"&_csrf=<?=Yii::$app->request->getCsrfToken()?>",
        dataType: "json",
        success: function(data){
          if(!data.errNo){
            $('#now_cart').html(data.nowProduct);
            $popSuccess.css('display','block');
            $mask.css('display','block');
          }else{
            layer.msg(data.msg,{time:1200});
          }
        }
      });

    });


    $pop.find('.close').on('click',function(e){
      e.preventDefault();
      $popSuccess.css('display','none');
      $mask.css('display','none');
    });
    $pop.find('.closeBtn').on('click',function(e){
      e.preventDefault();
      $popSuccess.css('display','none');
      $mask.css('display','none');
    });
    $pop.find('.goOn').on('click',function(e){
      e.preventDefault();
      window.location.reload();
//      $input.val($minCount);
//      $popSuccess.css('display','none');
//      $mask.css('display','none');
    });



    var $oneStar=$('.oneStar');
    var $collectTip=$('.collectTip');
    $('.sharedInfo').find('.collect').on('click',function(){
      var uid = <?php echo Yii::$app->user->isGuest?1:0?>;
      if(uid){
        layer.msg('请先登录',{time:1200},function(){
          window.location.href = '/site/login';
        });
        return false;
      }
      var id = <?=Yii::$app->request->get('id')?>;
      if(!$oneStar.hasClass('collected')){
        //添加收藏
        $.post('',{'cid':id,'action':1},function(data){
          if(data == -1){
            layer.msg('请先登录',{time:1200},function(){
              window.location.href = '/site/login';
            });
            return false;
          }
          if(data>0){   //-------------提示跳转登陆
            $oneStar.addClass('collected');
            $collectTip.css({display: 'block',opacity: '1',top: '260px'});
            setTimeout(function(){$collectTip.animate({top: '60px',opacity: '0'},400);},1000);
          }
        });
      }else{
        $.post('',{'cid':id,'action':0},function(data){
          if(data){
            $oneStar.removeClass('collected');
            layer.msg('取消成功',{time:1200});
          }
        })
      }
    });

    $('.dealInfo').find('.navs').children('li').on('click',function(){
      var $n=$(this).index();
      $(this).addClass('cur').siblings().removeClass('cur');
      $('.tabItems').children('.item').css('display','none').eq($n).css('display','block');
    });


    var $sampleNow=$('.sampleNow');
    var $sampleFailTip=$('.sampleFailTip');
    $sampleNow.on('click',function(e){
      e.preventDefault();
      $sampleFailTip.css({display: 'block',opacity: '1',top: '260px'});
      setTimeout(function(){$sampleFailTip.animate({top: '60px',opacity: '0'},400);},1000);
    });


    //配送区域JS
    var $sec_childs=$('.sec_childs');
    var $sec_item=$sec_childs.find('.sec_item');
    var $sec_level1=$('.sec_level1');
    var $sec_level2=$('.sec_level2');
    var $sec_level3=$('.sec_level3');
    var $sec_levels=$('.sec_level');
    var $input_btn=$('.input_btn');
    var $selectLists=$('.selectLists');
    var $navLi=$('.selectBox').find('.navList').children('li');

    //一级区域点击方法
    $sec_level1.find('.sec_item').on('click',function(){
      $navLi.eq(0).text($(this).text()).attr('value',$(this).attr('value'));
      $navLi.eq(1).text('请选择城市');

      if($navLi.eq(2).css('display')=='block'){
        $navLi.eq(2).css('display','none');
      }

      $(this).addClass('selected').siblings().removeClass('selected');

      var province_id=$(this).attr('value');

      var url = '/product/'+<?php echo Yii::$app->request->get('id')?>;

      //AJAX获取省级id对应的市的信息

      $.post(url,{'province_id':province_id},function(data){
        var data = eval('('+data+')');
        var level2Str='';

        for(var k in data){
          level2Str+='<a class="sec_item" value="'+data[k]["id"]+'" href="javascript:void(0);">'+data[k]["name"]+'</a>';
          $sec_level2.html(level2Str);
        }
      });

      $sec_levels.css('display','none').eq(1).css('display','block');
      $navLi.removeClass('cur').eq(1).addClass('cur');
    });

    ////二级区域点击方法
    $sec_level2.on('click','.sec_item',function(){

      $navLi.eq(1).text($(this).text()).attr('value',$(this).attr('value'));

      $navLi.removeClass('cur').eq(2).css('display','block').addClass('cur');
      $(this).addClass('selected').siblings().removeClass('selected');

      var city_id=$(this).attr('value');
      var url = '/product/'+<?php echo Yii::$app->request->get('id')?>;

      //AJAX获取市级id对应的下级区域的信息

      $.post(url,{'city_id':city_id},function(data){
        var data = eval('('+data+')');
        var level3Str='';

        for(var k in data){
          level3Str+='<a class="sec_item" value="'+data[k]["id"]+'" href="javascript:void(0);">'+data[k]["name"]+'</a>';
          $sec_level3.html(level3Str);
        }
      });

      $sec_level2.css('display','none');
      $sec_level3.css('display','block');
    });


    $sec_level3.on('click','.sec_item',function(){

      $navLi.eq(2).text($(this).text()).attr('value',$(this).attr('value'));

      if($navLi.eq(0).text()==$navLi.eq(1).text()){
        var str=$navLi.eq(0).text()+$navLi.eq(2).text();
      }else {
        var str=$navLi.eq(0).text()+$navLi.eq(1).text()+$navLi.eq(2).text();
      }

      $(this).addClass('selected').siblings().removeClass('selected');
      $input_btn.find('.txts').text(str);
      $selectLists.css('display','none');
    });

    $input_btn.on('click',function(){
      $selectLists.css('display','block');
    });

    $navLi.on('click',function(){
      if(!$(this).hasClass('cur')){
        $navLi.removeClass('cur');
        $(this).addClass('cur');
        $sec_levels.css('display','none').eq($(this).index()).css('display','block');
      }
    });

    //关闭区域选择框
    $('.closeSeletBox').on('click',function(){
      $selectLists.css('display','none');
    });

    //商品图片放大预览
    $('.topMask').on('mousemove',function(event){
      var $index=$thumbnail.find('.images').children('.active').index();
      $('.bigImage').find('img').removeClass('current').eq($index).addClass('current');
      var left=event.offsetX-85;
      left=left>170?170:left>0?left:0;
      var top=event.offsetY-85;
      top=top>170?170:top>0?top:0;
      $('.maskLook').css({
        display: 'block',
        left: left,
        top: top
      });
      $('.bigImage').css('display','block').children('.current').css({
        left: -(2*left),
        top: -(2*top)
      });
    });
    $('.topMask').on('mouseleave',function(){
      $('.maskLook').css('display', 'none');
      $('.bigImage').css('display','none');
    });

//    $('.bigImage').children('img').eq(0).css('display','block');
  })
</script>



<script type="text/javascript">
  $(function(){
    //AJAX分页
    $(".evaluteToggle span[name=order_list]").click(function(){

      var value = parseInt($(this).attr('value'));
      //更改当前页码
      $('#curr').text(value);

      //更改前一页后一页的value
      if((parseInt(value)-1)==0){
        $('.evalutePre[name=order_list]').attr('value',1);
      }else{
        $('.evalutePre[name=order_list]').attr('value',value-1);
      }

      var last = parseInt(<?php echo intval($page['last_page'])?>);

      if((value+1)>last){
        $('.evaluteNext[name=order_list]').attr('value',last);
      }else{
        $('.evaluteNext[name=order_list]').attr('value',value+1);
      }
      var id = <?php echo Yii::$app->request->get('id')?>;
      $.post('/product/'+id,{'name':'order_list','page':value},function(data){
        var data = eval('('+data+')');
        $('.dealLists .records p').remove();

        for(var k in data){
          $('.dealLists .records').append(
            '<p class="oneRecord"><span>'+data[k]["username"]+'</span><span style="margin-left:5px" class="price">'+data[k]["order_fee"]+'</span><span style="margin-left:4px">'+data[k]["product_num"]+' 个</span><span style="margin-left:5px" class="dealTime">'+data[k]["create_time"]+'</span></p>'
          )
        }
      });

    });
  });
</script>